<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
homeTest
<div>
    <button type="submit"  onclick="logout()">登 出</button>
    <button type="submit"><a href="/logoutTest">登 出2</a></button>

</div>

<!-- jquery库 -->
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

<!-- 自定义js执行函数 -->
<script>

    $(document).ready(function () {
        $.ajax({
            type: "post",
            // ..代表的应该是 http://localhost:8080
            url: "../noCacheTest",
            contentType : 'application/json;charset=utf-8',
            dataType: "json",
            async:false,
            success: function(data){
                console.log(data.judgeResult)
                if (data.judgeResult){
                    // alert("有session，不用刷新");
                }else {
                    // alert("没session，刷新成功");
                    location.reload(true);
                }
            }
        });
    });


    function test(){
        $.ajax({
            type: "post",
            // ..代表的应该是 http://localhost:8080
            url: "../noCacheTest",
            contentType : 'application/json;charset=utf-8',
            dataType: "json",
            async:false,
            success: function(data){
                console.log(data.judgeResult)
                if (data.judgeResult){
                    // alert("有session，不用刷新");
                }else {
                    // alert("没session，刷新成功");
                    location.reload(true);
                }
            }
        });
    }


    function logout() {

        $.ajax({
            type: "post",
            // ..代表的应该是 http://localhost:8080
            url: "../logoutTest",
            contentType : 'application/json;charset=utf-8',
            dataType: "json",
            success: function(data){
                console.log(data)
                alert("登出成功！！");
            }
        });
    }
</script>
</body>
</html>